package com.tian.core.entity;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Mastergroup entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "mastergroup", catalog = "portalservermond")
public class Mastergroup implements java.io.Serializable {

	// Fields

	private Integer id;
	private Master master;
	private Group group;
	private String name;
	private Integer cmasterid;
	private Date createdate;

	// Constructors

	/** default constructor */
	public Mastergroup() {
	}

	/** minimal constructor */
	public Mastergroup(Master master, Group group, Integer cmasterid) {
		this.master = master;
		this.group = group;
		this.cmasterid = cmasterid;
	}

	/** full constructor */
	public Mastergroup(Master master, Group group, String name,
			Integer cmasterid, Date createdate) {
		this.master = master;
		this.group = group;
		this.name = name;
		this.cmasterid = cmasterid;
		this.createdate = createdate;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "masterid", nullable = false)
	public Master getMaster() {
		return this.master;
	}

	public void setMaster(Master master) {
		this.master = master;
	}

	//@ManyToOne(fetch = FetchType.LAZY)
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "groupid", nullable = false)
	public Group getGroup() {
		return this.group;
	}

	public void setGroup(Group group) {
		this.group = group;
	}

	@Column(name = "name", length = 100)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "cmasterid")
	public Integer getCmasterid() {
		return this.cmasterid;
	}

	public void setCmasterid(Integer cmasterid) {
		this.cmasterid = cmasterid;
	}

	@Column(name = "createdate", length = 0)
	public Date getCreatedate() {
		return this.createdate;
	}

	public void setCreatedate(Date createdate) {
		this.createdate = createdate;
	}

}